<fieldset>
    <legend>Add Category</legend>
    
    <form name="form-category-update" method="post" action="">
        <table>
            <tr>
                <td>Parent: </td>
                <td>
                    <select name="ParentID">
                        <?php
                            foreach($categoryRoot as $category)
                            {
                                if($category['CategoryID'] == $categoryDetail['ParentID'])
                                {
                                    echo '<option selected="true" value="'.$category['CategoryID'].'">'.$category['Name'].'</option>';
                                }
                                else
                                {
                                    echo '<option value="'.$category['CategoryID'].'">'.$category['Name'].'</option>';
                                }
                                
                            }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>Type: </td>
                <td>
                    <select name="Type">
                        <option <?php $categoryDetail['Type']==1?'selected="true"':'' ;?> value="1">Products</option
                        <option <?php $categoryDetail['Type']==2?'selected="true"':'' ;?> value="2">Notes</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>Name: </td>
                <td><input type="text" name="Name" class="text" value="<?php echo $categoryDetail['Name']; ?>"/></td>
            </tr>
            <tr>
                <td>Description: </td>
                <td><textarea name="Description" style="width:300px; height: 50px"><?php echo $categoryDetail['Description']; ?></textarea></td>
            </tr>
            <tr>
                <td>Status: </td>
                <td>
                    <select name="Status">
                        <option <?php $categoryDetail['Status']==1?'selected="true"':'' ;?> value="1">Active</option
                        <option <?php $categoryDetail['Status']!=1?'selected="true"':'' ;?> value="0">Deactivate</option>
                    </select>
                </td>
            </tr>
        </table>
        <hr/>
        <div>
            <?php
                if(isset($categoryError))
                {
                    echo '<div class="error">'.$categoryError.'</div>';
                }
                if(isset($categorySuccess))
                {
                    echo '<div class="success">'.$categorySuccess.'</div>';
                }
            ?>
            <div style="text-align: right">
                <input type="hidden" name="CategoryId" value="<?php $categoryDetail['CategoryID']; ?>" />
                <input type="submit" name="submit" value="Update" class="button"/>
            </div>
        </div>
    </form>
</fieldset>
